Merge "Provide an opt-out preference for New Filters for RecentChanges"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Tue, 12 Sep 2017 00:30:13 +0000 (00:30 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Tue, 12 Sep 2017 00:30:13 +0000 (00:30 +0000)
1  2 
includes/specialpage/ChangesListSpecialPage.php
languages/i18n/en.json
languages/i18n/qqq.json

@@@ -519,25 -519,16 +519,25 @@@ abstract class ChangesListSpecialPage e
        public function execute( $subpage ) {
                $this->rcSubpage = $subpage;
  
 -              $this->setHeaders();
 -              $this->outputHeader();
 -              $this->addModules();
 -
                $rows = $this->getRows();
                $opts = $this->getOptions();
                if ( $rows === false ) {
                        $rows = new FakeResultWrapper( [] );
                }
  
 +              // Used by Structured UI app to get results without MW chrome
 +              if ( $this->getRequest()->getVal( 'action' ) === 'render' ) {
 +                      $this->getOutput()->setArticleBodyOnly( true );
 +              }
 +
 +              // Used by "live update" and "view newest" to check
 +              // if there's new changes with minimal data transfer
 +              if ( $this->getRequest()->getBool( 'peek' ) ) {
 +                      $code = $rows->numRows() > 0 ? 200 : 304;
 +                      $this->getOutput()->setStatusCode( $code );
 +                      return;
 +              }
 +
                $batch = new LinkBatch;
                foreach ( $rows as $row ) {
                        $batch->add( NS_USER, $row->rc_user_text );
                        }
                }
                $batch->execute();
 +
 +              $this->setHeaders();
 +              $this->outputHeader();
 +              $this->addModules();
                $this->webOutput( $rows, $opts );
  
                $rows->free();
        /**
         * Include the modules and configuration for the RCFilters app.
         * Conditional on the user having the feature enabled.
 +       *
 +       * If it is disabled, add a <body> class marking that
         */
        protected function includeRcFiltersApp() {
 +              $out = $this->getOutput();
                if ( $this->isStructuredFilterUiEnabled() ) {
 -                      $out = $this->getOutput();
                        $jsData = $this->getStructuredFilterJsData();
  
                        $messages = [];
                                $messages[$key] = $this->msg( $key )->plain();
                        }
  
 +                      $out->addBodyClasses( 'mw-rcfilters-enabled' );
 +
                        $out->addHTML(
                                ResourceLoader::makeInlineScript(
                                        ResourceLoader::makeMessageSetScript( $messages )
                                        'daysDefault' => $this->getDefaultDays(),
                                ]
                        );
 +              } else {
 +                      $out->addBodyClasses( 'mw-rcfilters-disabled' );
                }
        }
  
         * ChangesListFilterGroup constructors.
         *
         * There is light processing to simplify core maintenance.
 +       * @param array $definition
         */
        protected function registerFiltersFromDefinitions( array $definition ) {
                $autoFillPriority = -1;
         * @return bool
         */
        public function isStructuredFilterUiEnabled() {
-               return $this->getUser()->getOption( 'rcenhancedfilters' );
+               if ( $this->getRequest()->getBool( 'rcfilters' ) ) {
+                       return true;
+               }
+               if ( $this->getConfig()->get( 'StructuredChangeFiltersShowPreference' ) ) {
+                       return !$this->getUser()->getOption( 'rcenhancedfilters-disable' );
+               } else {
+                       return $this->getUser()->getOption( 'rcenhancedfilters' );
+               }
+       }
+       /**
+        * Check whether the structured filter UI is enabled by default (regardless of
+        * this particular user's setting)
+        *
+        * @return bool
+        */
+       public function isStructuredFilterUiEnabledByDefault() {
+               if ( $this->getConfig()->get( 'StructuredChangeFiltersShowPreference' ) ) {
+                       return !$this->getUser()->getDefaultOption( 'rcenhancedfilters-disable' );
+               } else {
+                       return $this->getUser()->getDefaultOption( 'rcenhancedfilters' );
+               }
        }
  
        abstract function getDefaultLimit();
diff --combined languages/i18n/en.json
        "parser-template-loop-warning": "Template loop detected: [[$1]]",
        "template-loop-category": "Pages with template loops",
        "template-loop-category-desc": "The page contains a template loop, ie. a template which calls itself recursively.",
 +      "template-loop-warning": "<strong>Warning:</strong> This page calls [[:$1]] which causes a template loop (an infinite recursive call).",
        "parser-template-recursion-depth-warning": "Template recursion depth limit exceeded ($1)",
        "language-converter-depth-warning": "Language converter depth limit exceeded ($1)",
        "node-count-exceeded-category": "Pages where node count is exceeded",
        "rcfilters-watchlist-markseen-button": "Mark all changes as seen",
        "rcfilters-watchlist-edit-watchlist-button": "Edit your list of watched pages",
        "rcfilters-watchlist-showupdated": "Changes to pages you haven't visited since the changes occurred are in <strong>bold</strong>, with solid markers.",
+       "rcfilters-preference-label": "Hide the improved version of Recent Changes",
+       "rcfilters-preference-help": "Rolls back the 2017 interface redesign and all tools added then and since.",
        "rcnotefrom": "Below {{PLURAL:$5|is the change|are the changes}} since <strong>$3, $4</strong> (up to <strong>$1</strong> shown).",
        "rclistfromreset": "Reset date selection",
        "rclistfrom": "Show new changes starting from $2, $3",
diff --combined languages/i18n/qqq.json
        "parser-template-loop-warning": "Parameters:\n* $1 - page title",
        "template-loop-category": "This message is used as a category name for a [[mw:Special:MyLanguage/Help:Tracking categories|tracking category]] where pages with template loops will be listed.",
        "template-loop-category-desc": "Pages with template loops category description. Shown on [[Special:TrackingCategories]].\n\nSee also:\n* {{msg-mw|Template-loop-category}}",
 +      "template-loop-warning": "This message is displayed in edit preview when a template loop is detected on the previewed page.\n\nParameters:\n* $1 - the full title of template which causes the template loop.",
        "parser-template-recursion-depth-warning": "Parameters:\n* $1 - limit value of recursion depth",
        "language-converter-depth-warning": "Error message shown when a page uses too deeply nested language conversion syntax. Parameters:\n* $1 - the value of the depth limit",
        "node-count-exceeded-category": "This message is used as a category name for a [[mw:Help:Tracking categories|tracking category]] where pages are placed automatically if the node-count of the preprocessor exceeds the limit.\n\nSee also:\n* {{msg-mw|Node-count-exceeded-warning}}",
        "rcfilters-watchlist-markseen-button": "Label for the button to mark all changes as seen on [[Special:Watchlist]] when using the structured filters interface.",
        "rcfilters-watchlist-edit-watchlist-button": "Label for the button to edit the watched pages on [[Special:Watchlist]] when using the structured filters interface.\n\nCf. {{msg-mw|watchlisttools-edit}}.",
        "rcfilters-watchlist-showupdated": "Message at the top of [[Special:Watchlist]] when the Structured filters are enabled that describes what unseen changes look like.\n\nCf. {{msg-mw|wlheader-showupdated}}",
+       "rcfilters-preference-label": "Option in RecentChanges tab of [[Special:Preferences]].",
+       "rcfilters-preference-help": "Explanation for the option in the RecentChanges tab of [[Special:Preferences]].",
        "rcnotefrom": "This message is displayed at [[Special:RecentChanges]] when viewing recentchanges from some specific time.\n\nThe corresponding message is {{msg-mw|Rclistfrom}}.\n\nParameters:\n* $1 - the maximum number of changes that are displayed\n* $2 - (Optional) a date and time\n* $3 - a date\n* $4 - a time\n* $5 - Number of changes are displayed, for use with PLURAL",
        "rclistfromreset": "Used on [[Special:RecentChanges]] to reset a selection of a certain date range.",
        "rclistfrom": "Used on [[Special:RecentChanges]]. Parameters:\n* $1 - (Currently not use) date and time. The date and the time adds to the rclistfrom description.\n* $2 - time. The time adds to the rclistfrom link description (with split of date and time).\n* $3 - date. The date adds to the rclistfrom link description (with split of date and time).\n\nThe corresponding message is {{msg-mw|Rcnotefrom}}.",
        "diff-form-revid": "Label for the field of the new revision in the comparison for [[Special:Diff]]",
        "diff-form-submit": "Submit button on [[Special:Diff]]",
        "diff-form-summary": "{{doc-specialpagesummary|diff}}",
 -      "permanentlink": "The title of [[Special:PermanentLink]]",
 -      "permanentlink-revid": "Label for the field for the revision ID in [[Special:PermanentLink]]",
 +      "permanentlink": "The title of [[Special:PermanentLink]]\n{{Identical|Permalink}}",
 +      "permanentlink-revid": "Label for the field for the revision ID in [[Special:PermanentLink]]\n{{Identical|Revision ID}}",
        "permanentlink-submit": "Submit button on [[Special:PermanentLink]]",
        "permanentlink-summary": "{{doc-specialpagesummary|permanentlink}}",
        "dberr-problems": "This message does not allow any wiki nor html markup.",